const { mongoose } = require('./db')

// 首页类型数据
const Htype = new mongoose.Schema({
    name: String,
    text: {
        type: [mongoose.Types.ObjectId],
        ref: 'Hdata'
    }
})

// 首页展示数据
const Hdata = new mongoose.Schema({
    name: String,
    price: Number,
    path: String,
    sell: String,
    num: {
        type: Number,
        default: 0
    }
})



const HtypeModel = mongoose.model('Htype', Htype, 'Htype')
const Hmodel = mongoose.model('Hdata', Hdata, 'Hdata')
const usercart = new mongoose.Schema({
    userid: String,
    clist: Array,
    num: Number,
    price: Number,
    item: Object,
    way: Object,
    time: String,
    state: Number,
    phone: Number
})

const cartmodel = mongoose.model('usercart', usercart, 'usercart')


module.exports = {
    HtypeModel,
    Hmodel,
    cartmodel,
}